package com.ouheng.shop.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

import com.ouheng.shop.dao.SexualityDao;
import com.ouheng.shop.dao.SexualitySubDao;
import com.ouheng.shop.domain.SexualityDO;
import com.ouheng.shop.service.SexualityService;



@Service
public class SexualityServiceImpl implements SexualityService {
	@Autowired
	private SexualityDao sexualityDao;
	
	@Autowired
	private SexualitySubDao sexualitySubDao;
	
	@Override
	public SexualityDO get(Long id){
		return sexualityDao.get(id);
	}
	
	@Override
	public List<SexualityDO> list(Map<String, Object> map){
		return sexualityDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return sexualityDao.count(map);
	}
	
	@Override
	public int save(SexualityDO sexuality){
		return sexualityDao.save(sexuality);
	}
	
	@Override
	public int update(SexualityDO sexuality){
		return sexualityDao.update(sexuality);
	}
	
	@Override
	@Transactional
	public int remove(Long id){
		sexualitySubDao.removeBySid(id);
		return sexualityDao.remove(id);
	}
	
	@Override
	@Transactional
	public int batchRemove(Long[] ids){
		for (Long long1 : ids) {
			sexualitySubDao.removeBySid(long1);
		}
		return sexualityDao.batchRemove(ids);
	}

	@Override
	public int maxSort() {
		return sexualityDao.maxSort();
	}
	
}
